<script lang="ts" setup>
import {useTheme} from "@/hooks/useTheme"
// 将 Element Plus 的语言设置为中文
import zhCn from "element-plus/es/locale/lang/zh-cn"
import UploadFile from "@/appComponents/Upload/UploadFile.vue";
import {ref, watch} from "vue";
import {UploadFileType, useUploadFile} from "@/store/modules/uploadFile";

const { initTheme } = useTheme()

/** 初始化主题 */
initTheme()
const UploadFileRef = ref(null)
watch(()=>UploadFileRef.value,(value, oldValue, onCleanup)=>{
  useUploadFile().setUploadInstance(<UploadFileType>value)
},{immediate: true,deep: true})
</script>

<template>
  <el-config-provider :locale="zhCn">
    <router-view />
    <UploadFile
      v-if="checkAuths(['upload'])"
      ref="UploadFileRef"
    ></UploadFile>
  </el-config-provider>
</template>
